#include "StdAfx.h"
#include "OtpEnvironment.h"

#include "OtpException.h"
#include "OtpSessionImpl.h"

namespace otp
{
  COtpEnvironment::COtpEnvironment(const std::string& acf_path) 
    : m_handle(NULL)
  {
    OtpCheck(oa_init(const_cast<char *>(acf_path.c_str()), &m_handle), "Fail to initialize OTP SDK");
  }

  COtpEnvironment::~COtpEnvironment(void)
  {
    OtpCheck(oa_uninit(m_handle), "Fail to uninitialize OTP SDK");
  }

  auth::IAuthSession *COtpEnvironment::createSession()
  {
    return new otp::impl::COtpSessionImpl(*this);
  }
} // namespace ace
